<extend name="Public/user"/>
<block name="user-right">
	<div class="user-right">
		<div class="user-head">
			<h2>支付代购订单</h2>
		</div>
		<div style="padding:10px;">
					<table class="yubao-add yubao-list" cellpadding="0" cellspacing="0" style="line-height: 25px;">
						<tr>
							<th colspan="3" style="padding:0 10px;text-align: left;">代购单号:{$info.dgsn}&nbsp;&nbsp;|&nbsp;&nbsp;{$info.consignee}&nbsp;&nbsp;|&nbsp;&nbsp;{$info.addtime|date="Y-m-d H:i:s",###}</th>
						</tr>
						<volist name="info.goods" id="g">
						<tr>
							<td>
								<div class="fl">
									<a href="{$g.goodsurl}" target="_blank" title="{$g.goodsname}">
										<img src="{$g.goodsimg}" width="60" height="60"></a>
								</div>
								<div class="fl" style="width:300px;font-size: 12px;padding-left: 10px;">
									<a href="{$g.goodsurl}" target="_blank" style="color:green;">{$g.goodsname}</a>
									<br>
									<span>尺寸：{$g.goodssize} &nbsp; 颜色：{$g.goodscolor}</span>
									<br>
									<span>备注：{$g.goodsremark}</span>
								</div>
							</td>
							<td>快递单号：<if condition="$g.kdsn neq ''">{$g.kdsn}<else />暂无</if><br><br>国际单号：<if condition="$g.bgsn neq ''">{$g.bgsn}<else />暂无</if></td>
							
							<td rowspan="{$v.goodscount}" >
								￥: {$g.goodsprice}(日元) <br>
								<if condition="$v.status eq 1">
								<div style="text-align: center;margin-top: 5px;"><a href="{:url('User/paydaigou','id='.$v['id'])}" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;">支付</a> | <a href="javascript:void(0);" style="display:inline-block;background: red;color: #fff;padding: 2px 2px;" did="{$v.id}" class="deldaigou">删除</a></div>
							</if>
							</td>
						
						</tr>
					</volist>
					</table>
					<div class="blank"></div>
					<div style="border: 1px solid #dfdfdf;background: #fafafa;text-align: right;padding:10px 20px;line-height: 30px;font-size: 14px;">
					商品金额：
					<span id="totalgoodsprice">{$info.totalgoodsprice}</span>
					(日元) + 运费：
					<span id="totalgoodsfreight">{$info.totalgoodsfreight}</span>
					(日元)
					<br>				
					总金额：
					<span id="totalprice">{$info.totalprice}</span>
					(日元) &nbsp; 共需支付金额：
					<span id="zhifuprice">{$info.zhifuprice}</span>
					{:config('MAIN_COIN')} <br>
					{:lang('your_balance')}：{$user.money} ({:config('MAIN_COIN')}) &nbsp;   {:config('MAIN_COIN')}
				</div>
				<div class="blank"></div>
				<div style="width:200px;float: right;line-height: 20px;">
					<a href="{:url('User/chongzhi')}" target="_blank" class="btnqd" id="quchongzhi">{:lang('recharge')}</a>
					<a href="javascript:;" target="_blank" class="btnqd" style="background:#2CDE98;border: 1px solid #2CDE98;" id="querenzhifu">{:lang('confirm_pay')}</a>
				</div>
				<div class="blank"></div>
		</div>
		<div class="clear"></div>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			if (<?php echo $info['zhifuprice'] ?><=<?php echo $member['available_predeposit']+$member['credit'] ?>) {
			$('#querenzhifu').show();
			$('#quchongzhi').hide();
		}else{
			$('#querenzhifu').hide();
			$('#quchongzhi').show();
		};
		if (<?php echo $info['zhifuprice'] ?><=0.00) {
			$('#querenzhifu').hide();
			$('#quchongzhi').hide();
		};
		$('#querenzhifu').click(function(){
			var id=<?php echo $info['id'] ?>;
			var loading=$.thinkbox.loading('Loading');
			$.post('{:url("paydaigouadd")}',{'id':id},function(data){
				if (data.status) {
					loading.hide();
					$.thinkbox.success(data.info);
					setTimeout(jumpurl(data.url),1500);
				}else{
					loading.hide();
					$.thinkbox.error(data.info);
				};
			})
		})
			$('.deldaigou').click(function(){
				var id=$(this).attr('did');
				$.thinkbox.confirm('确定要删除代购单么',{
				 	'dataEle' : this,
				 	'title':'温馨提示',
                    'ok':'确认删除',
                    'cancel':'关闭',
				 	'afterHide':function(data){
				 		if (data==true) {
				 			$.post("{:url('User/deldaigou')}",{'id':id},function(data){
					if (data.status) {
						$.thinkbox.success(data.info);
						setTimeout('location.reload()',1500);
					}else{
						$.thinkbox.error(data.info);
					};
				})
				 		};
				 	},
				 })
			})
		})
	</script>
</block>